﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace com.huigo.Framework.Service
{
    public class DictEnum
    {
        public enum Source
        {
            B2BWEB = 1,
            ADMINWEB = 2,
            OEMWEB = 3,
            API = 4
        };

        public static Dictionary<int, Credential> DictSource = new Dictionary<int, Credential>
        { 
           {1,new Credential("b2bweb","ED6AD55741104C63BE0BB01F3FAA405E")},
           {2,new Credential("adminweb","ED6AD55741104C63BE0BB01F3FAA405E")},
        };

        public static int VerifyPin(string acc, string pin)
        {
            Credential cc = new Credential(acc, pin);
            int key = 0;
            foreach (KeyValuePair<int, Credential> kvp in DictSource)
            {
                if (cc.ACC.Equals(kvp.Value.ACC) && cc.PIN.Equals(kvp.Value.PIN))
                {
                    key = kvp.Key;
                    break;
                }
            }
            return key;
        }

    }

    public class Credential
    {
        public string ACC;
        public string PIN;

        public Credential(string acc, string pin)
        {
            ACC = acc;
            PIN = pin;
        }
    }
}
